Class FeinduraBase File source: /library/classes/FeinduraBase.class.php
Description
The basis feindura class for the implementation classes.
It's methods provide necessary functions for the feindura and the feinduraModules classes.
Version
| Child Class | Description |
|---|---|
| Feindura | The class for implementing feindura - Flat File Content Management System in a website. |
| string | $sessionId | Contains the session-ID, if cookies are deactivated |
| array | $varNames | Contains the variable names used for the $_GET variables |
| bool | $loggedIn | Is TRUE when the user is logged into the backend of feindura and visits the frontend website. |
| array | $adminConfig | Contains the administrator-settings and the page-settings set in the CMS backend |
| array | $websiteConfig | Contains the website-settings config set in the CMS backend |
| array | $categoryConfig | Contains the categories-settings config set in the CMS backend |
| string | $language | A country code (example: de, en, ..) to set the language of the frontend language-files |
| array | $languageFile | Contains the frontend language-file array |
| void | __construct() | The constructor of the class, sets all basic properties. First gets all settings config arrays and external... |
| int|false | getCurrentPageId() | Returns the current page ID from the $_GET variable. Gets the current page ID from the $_GET variable. If... |
| int|false | getCurrentCategoryId() | Returns the current category ID from the $_GET variable. Gets the current category ID from the $_GET variable.... |
| string | replaceLinks() | Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter,... |
| int|false | setCurrentPageId() | Sets the current page ID from the $_GET variable to the $page property. Gets the current page ID from the $_GET... |
| int|false | setCurrentCategoryId() | Sets the current category ID from the $_GET variable to the Feindura::$category property. Gets the current... |
| string | loadFrontendLanguageFile() | Loads the frontend language file into the $languageFile property. |
| array | generatePage() | This method uses the $showErrors, $titleLength and $thumbnailAlign properties. Generates a page. This method is... |
| string | createTitle() | Generates a page title from a given $pageContent array by using the given parameters. |
| array|false | createThumbnail() | Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to... |
| string | createAttributes() | Generates a string with a given id, class and other attributes. Check whether the given parameters are strings or... |
| array|false | loadPagesByType() | Load pages by ID-type and ID(s). If the $idType parameter start with "cat" it takes the given $ids... |
| array|false | loadPagesByDate() | Loads pages by ID-type and ID, which fit in the given time period parameters. Checks if the pages to load have a... |
| array|false | compareTags() | Compares the given tags with the tags in the given $pageContent array. If the given $pageContent array has one... |
| array|false | hasTags() | Load pages by ID-type and ID(s), but only if the page(s) have one or more tags from the given $tags parameter.... |
| array|false | getPropertyIdsByString() | Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and... |
| int|false | getPropertyIdsByType() | If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category... |
| mixed | getPropertyPage() | Returns the Feindura::$page property if the given $page parameter is a Boolean. |
| int|true | getPropertyCategory() | Returns the Feindura::$category property if the given $category parameter is a Boolean. |
| string | shortenText() | Shorten a text by to a given length. If the $endString parameter is set and a $pageContent array is given, it... |
| string | shortenHtmlText() | Shorten a HTML text by to a given length. All HTML tags which are contained in the shortend text will be counted... |
Default value
nullDescription
Contains the session-ID, if cookies are deactivated
This session ID is then placed on the end of every link.
Used By
- FeinduraBase::__construct() - the session ID string will set to this property, if cookies are deactivated
Default value
array('page' => 'page', 'category' => 'category', 'modul' => 'modul')Description
Contains the variable names used for the $_GET variables
This variable names are configured in the feindura adminstrator-settings and set in the FeinduraBase() constructor to the this property.
For standard value see above.
Example of a link using the standard variable names: http://www.examplepage.com/index.php?category=1&page=6
Used By
- FeinduraBase::__construct() - the variable names from the administrator-settings config will set to this property
- FeinduraBase::getCurrentPageId() - for variable names which the $_GET will use for the page ID
- FeinduraBase::getCurrentCategoryId() - for variable names which the $_GET variable will use for the category ID
Default value
falseDescription
Is TRUE when the user is logged into the backend of feindura and visits the frontend website.
If TRUE, it will enable the the frontend editing feature.
Used By
- FeinduraBase::__construct() - to set whether the visitor is logged in or not
Default value
Description
Contains the administrator-settings and the page-settings set in the CMS backend
The file with the administrator-settings config array is situated at "feindura-CMS/config/admin.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
<?php $adminConfig['url'] = 'http://localhost'; $adminConfig['basePath'] = '/feinduraCMS/'; $adminConfig['realBasePath'] = '/var/server/feinduraCMS/'; $adminConfig['websitePath'] = '/'; // it's also possible: "/index.php" $adminConfig['uploadPath'] = '/feinduraCMS/upload/'; $adminConfig['websiteFilesPath'] = ''; $adminConfig['stylesheetPath'] = '/styles/'; $adminConfig['dateFormat'] = 'int'; // can be "int" or "eu" $adminConfig['speakingUrl'] = false; $adminConfig['varName']['page'] = 'page'; $adminConfig['varName']['category'] = 'category'; $adminConfig['varName']['modul'] = 'modul'; $adminConfig['user']['editWebsiteFiles'] = false; $adminConfig['user']['editStyleSheets'] = false; $adminConfig['user']['info'] = ''; $adminConfig['setStartPage'] = true; $adminConfig['pages']['createDelete'] = true; $adminConfig['pages']['thumbnails'] = true; $adminConfig['pages']['plugins'] = false; $adminConfig['pages']['showTags'] = false; $adminConfig['editor']['enterMode'] = 'p'; $adminConfig['editor']['styleFile'] = '/styles/sheet.css'; $adminConfig['editor']['styleId'] = 'contentId'; $adminConfig['editor']['styleClass'] = ''; $adminConfig['pageThumbnail']['width'] = '115'; $adminConfig['pageThumbnail']['height'] = ''; $adminConfig['pageThumbnail']['ratio'] = 'x'; $adminConfig['pageThumbnail']['path'] = 'thumbnails/'; // relativer to the ['uploadPath'] ?>
Used By
- FeinduraBase::__construct() - the administrator-settings config array will set to this property
- FeinduraBase::getCurrentPageId() - to look if set startpage is allowed
- FeinduraBase::getCurrentCategoryId() - to look if set startpage is allowed
- FeinduraBase::setCurrentPageId() - to check if setting a startpage is allowed
- FeinduraBase::setCurrentCategoryId() - to check if setting a startpage is allowed
- FeinduraBase::generatePage() - for the thumbnail upload path
- FeinduraBase::createThumbnail() - for the thumbnail path
Default value
Description
Contains the website-settings config set in the CMS backend
The file with the website-settings config array is situated at "feindura-CMS/config/website.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
<?php $websiteConfig['title'] = 'Example Website'; $websiteConfig['publisher'] = 'Puslisher'; $websiteConfig['copyright'] = 'Copyrightholder'; $websiteConfig['keywords'] = 'keyword1,keyword2,keyword3,keyword4'; $websiteConfig['description'] = 'This example website is intended to show how easy it is to use feindura CMS.'; $websiteConfig['email'] = 'info@examplewebsite.com'; $websiteConfig['startPage'] = 1; ?>
Used By
- FeinduraBase::__construct() - the website-settings config array will set to this property
- FeinduraBase::setCurrentPageId() - to get the startpage ID
- FeinduraBase::setCurrentCategoryId() - to get the startpage ID
- Feindura::createMetaTags() - for the website title, publisher, copyright, description and keywords
Default value
Description
Contains the categories-settings config set in the CMS backend
The file with the categories-settings config array is situated at "feindura-CMS/config/category.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
<?php $categoryConfig[1]['id'] = 1; $categoryConfig[1]['name'] = 'Example Category 1'; $categoryConfig[1]['public'] = true; $categoryConfig[1]['createDelete'] = true; $categoryConfig[1]['thumbnail'] = true; $categoryConfig[1]['plugins'] = true; $categoryConfig[1]['showTags'] = true; $categoryConfig[1]['showPageDate'] = true; $categoryConfig[1]['sorting'] = 'byPageDate'; $categoryConfig[1]['styleFile'] = '/styles/sheet.css'; $categoryConfig[1]['styleId'] = 'contentId'; $categoryConfig[1]['styleClass'] = 'contentClass'; $categoryConfig[1]['thumbWidth'] = '100'; $categoryConfig[1]['thumbHeight'] = ''; $categoryConfig[1]['thumbRatio'] = 'x'; $categoryConfig[2]['id'] = 2; $categoryConfig[2]['name'] = 'Example Category 2'; $categoryConfig[2]['public'] = false; $categoryConfig[2]['createDelete'] = false; $categoryConfig[2]['thumbnail'] = false; $categoryConfig[2]['plugins'] = false; $categoryConfig[2]['showTags'] = false; $categoryConfig[2]['showPageDate'] = false; $categoryConfig[2]['sorting'] = 'manually'; $categoryConfig[2]['styleFile'] = ''; $categoryConfig[2]['styleId'] = ''; $categoryConfig[2]['styleClass'] = ''; $categoryConfig[2]['thumbWidth'] = '150'; $categoryConfig[2]['thumbHeight'] = '100'; $categoryConfig[2]['thumbRatio'] = ''; ... ?>
Used By
- FeinduraBase::__construct() - the category-settings config array will set to this property *
- FeinduraBase::getCurrentCategoryId() - for the right category name, if the $_GET variable is not a ID but a category name
- FeinduraBase::generatePage() - to check whether the category of the page allows thumbnails
- FeinduraBase::createTitle() - to check if showing the page date is allowed and for the category name
- FeinduraBase::createThumbnail() - to check if thumbnails are allowed for the th category of this page
- FeinduraBase::loadPagesByDate() - to check if in the category is sorting by page date allowed
Default value
'en'Description
A country code (example: de, en, ..) to set the language of the frontend language-files
This country code is used to include the right frontend language-file. The frontend language-file is used when displaying page warnings or errors and additional texts like "more", etc.
This property will be set in the feindura constructor.
The standard value is "en" (english).
Used By
- FeinduraBase::__construct() - to set the given $language parameter to, or try to find out the browser language
- Feindura::setLanguage() - the language country code like "en", "de", ... which will be returned
- Feindura::getLanguage() - the language country code like "en", "de", ... which will be returned
Default value
nullDescription
Contains the frontend language-file array
The frontend language file array contains texts for displaying page warnings or errors and additional texts like "more", etc.
The file is situated at "feindura-CMS/library/languages/de.frontend.php".
It will be included and set to this property in the FeinduraBase constructor.
Used By
- FeinduraBase::__construct() - set the loaded frontend language-file to this property
- FeinduraBase::generatePage() - for the error texts
- FeinduraBase::createTitle() - for showing "yesterday", "today" or "tomorrow" instead of a page date
Parameters
| string | $language |
(optional) A country code "de", "en", ... to load the right frontend language-file and will be set to the $language property Default false |
-
Feindura::__construct()
: Type constructor
Description
Type constructor
The constructor of the class, sets all basic properties.
First gets all settings config arrays and external classes.
Then Check if the visitor is a logged in user of the feindura backend and set the FeinduraBase::$loggedIn property. Then set the $_GET variable names from the administrator-settings config to the $varNames property.
Check if cookies are activated, otherwise store the session ID in the $sessionId property for use in links.
Get the the given $language parameter or try to find the browser language and load the frontend language-file and set it to the $languageFile property.
Used Global Variables
- $adminConfig the administrator-settings config (included in the general.include.php)
- $websiteConfig the website-settings config (included in the general.include.php)
- $categoryConfig the categories-settings config (included in the general.include.php)
Used By
- Feindura::__construct() - the constructor of the parent class to load all necessary properties
Uses
- FeinduraBase::$adminConfig - the administrator-settings config array will set to this property
- FeinduraBase::$websiteConfig - the website-settings config array will set to this property
- FeinduraBase::$categoryConfig - the category-settings config array will set to this property *
- FeinduraBase::$loggedIn - to set whether the visitor is logged in or not
- FeinduraBase::$varNames - the variable names from the administrator-settings config will set to this property
- FeinduraBase::$sessionId - the session ID string will set to this property, if cookies are deactivated
- FeinduraBase::$language - to set the given $language parameter to, or try to find out the browser language
- FeinduraBase::$languageFile - set the loaded frontend language-file to this property
- StatisticFunctions::saveWebsiteStats() - save the website statistic like user visit count, first and last visit AND the visit time of the last visited pages
Version
Description
Name getCurrentPageId()
Alias getPageId()
Returns the current page ID from the $_GET variable.
Gets the current page ID from the $_GET variable. If $_GET is not a ID but a page name, it loads all pages in an array and look for the right page name and returns the ID. If no $_GET variable exists try to return the Feindura::$startPage property.
Used Global Variables
- $_GET to fetch the page ID
Used By
- FeinduraBase::setCurrentPageId() - to get the Feindura::$page property or the Feindura::$startPage property
Uses
- FeinduraBase::$varNames - for variable names which the $_GET will use for the page ID
- FeinduraBase::$adminConfig - to look if set startpage is allowed
- Feindura::$startPage - if no $_GET variable exists it will try to get the Feindura::$startPage property
- GeneralFunctions::loadPages() - for loading all pages to get the right page ID, if the $_GET variable is not a ID but a page name
Return Value
Version
Description
Name getCurrentCategoryId()
Alias getCategoryId()
Returns the current category ID from the $_GET variable.
Gets the current category ID from the $_GET variable. If $_GET is not a ID but a category name, it look in the FeinduraBase::$categoryConfig for the right category ID. If no $_GET variable exists it try to return the Feindura::$startPage property.
Used Global Variables
- $_GET to fetch the category ID
Used By
- FeinduraBase::setCurrentCategoryId() - to get the Feindura::$category property or the $startCategory property
Uses
- FeinduraBase::$varNames - for variable names which the $_GET variable will use for the category ID
- FeinduraBase::$adminConfig - to look if set startpage is allowed
- FeinduraBase::$categoryConfig - for the right category name, if the $_GET variable is not a ID but a category name
- Feindura::$startCategory - if no $_GET variable exists it will try to get the Feindura::$startCategory property
Return Value
Version
Parameters
| string | $pageContentString |
the page content string, to replace all feindura links, with real hrefs |
Description
Name replaceLinks()
Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter, with real href links.
Uses
- GeneralFunctions::readPage() - to load the page for createHref()
- GeneralFunctions::createHref() - to create the hreaf of the link
Return Value
Version
Parameters
| bool | $setStartPage |
(optional) If set to TRUE it also sets the Feindura::$startPage property Default false |
Description
Name setCurrentPageId()
Alias setPageId()
Sets the current page ID from the $_GET variable to the $page property.
Gets the current page ID from the $_GET variable (through getCurrentPageId) and set it to the $page property. If the $setStartPage parameter is TRUE and the Feindura::$category is empty, the Feindura::$startPage property will also be set with the start page ID from the $websiteConfig.
Used By
- Feindura::__construct() - to set the fetched page ID from the $_GET variable to the $page property
Uses
- FeinduraBase::$adminConfig - to check if setting a startpage is allowed
- FeinduraBase::$websiteConfig - to get the startpage ID
- Feindura::$page - as the property to set
- Feindura::$startPage - if the $setStartPage parameter is TRUE this property will also be set
- FeinduraBase::getCurrentPageId() - to get the Feindura::$page property or the Feindura::$startPage property
Return Value
Version
Parameters
| bool | $setStartCategory |
(optional) If set to TRUE it also sets the $startCategory property Default false |
Description
Name setCurrentCategoryId()
Alias setCategoryId()
Sets the current category ID from the $_GET variable to the Feindura::$category property.
Gets the current category ID from the $_GET variable (through getCurrentCategoryId) and set it to the Feindura::$category property. If the $setStartCategory parameter is TRUE the $startCategory property will also be set with the startpage ID from the $websiteConfig.
Used By
- Feindura::__construct() - to set the fetched category ID from the $_GET variable to the $category property
Uses
- FeinduraBase::$adminConfig - to check if setting a startpage is allowed
- FeinduraBase::$websiteConfig - to get the startpage ID
- Feindura::$category - as the property to set
- Feindura::$startCategory - if the $setStartCategory parameter is TRUE this property will also be set
- FeinduraBase::getCurrentCategoryId() - to get the Feindura::$category property or the $startCategory property
- GeneralFunctions::getPageCategory() - to get the right category ID of the startpage
Return Value
Version
Parameters
| string | $language |
(optional) a given country code which will be used to try to load the language file Default false |
Description
Name loadFrontendLanguageFile()
Loads the frontend language file into the $languageFile property.
Uses
- GeneralFunctions::loadLanguageFile() - to load the language files
Return Value
Version
line 655
| array generatePage ( |
int|array $page, [bool $showErrors = true], [int|array|bool $shortenText = false], [bool|string $useHtml = true]) |
Parameters
| int|array | $page |
page ID or a $pageContent array |
| bool | $showErrors |
(optional) says if errors like "The page you requested doesn't exist" will be displayed Default true |
| int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') Default false |
| bool|string | $useHtml |
(optional) displays the page content with or without HTML tags. It also accepts a string with allowed html tags. Default true |
Description
Name generatePage()
This method uses the $showErrors, $titleLength and $thumbnailAlign properties.
Generates a page.
This method is called in descendant classes.
Generates a page by the given page ID. An array will be returned with all elements of the page, ready for displaying in a HTML-page.
In case the page doesn't exists or is not public and the $showErrors parameter is TRUE, an error will be placed in the ['content'] part of the returned array, otherwiese it returns an empty array.
Example of the returned array:
<?php array( 'id' => 1, 'category' => 'Example Category', 'pageDate' => '2000-12-31', // format depending on the administrator-settings 'pageDateTimestamp' => 1325393999, 'title' => 'Title Example', 'thumbnail' => '<img src="/path/thumb_page1.png" alt="Thumbnail" title="Title Example" />', 'thumbnailPath' => '/path/thumb_page1.png', 'content' => "\n".'<p>Content Text</p>'."\n", // the content has line breaks before and after 'description' => 'Short description of the page', 'tags' => 'tag1 tag2 tag3', 'plugins' => array( 'imageGallery' => array( 'active' = true, 'galleryPath' = '/upload/gallery/', 'imageWidth' = 800, 'imageHeight' = null, 'thumbnailWidth' = 160, 'thumbnailHeight' = null, 'tag' = 'table', 'breakAfter' = 3 ), 'pageRating' => array( 'active' = false, 'value' = 0, 'votes' = 0 ) ) ) ?>
Used By
- Feindura::showPage() - to generate the array with the page elements
- Feindura::hasPlugins() - to generate the array with the page elements
- Feindura::showPlugins() - to generate the array with the page elements
- Feindura::listPages() - to generate every page which will be listed
- Feindura::listPagesBySortFunction() - to generate every page which will be listed
Uses
- FeinduraBase::$adminConfig - for the thumbnail upload path
- FeinduraBase::$categoryConfig - to check whether the category of the page allows thumbnails
- FeinduraBase::$languageFile - for the error texts
- Feindura::$page
- Feindura::$xHtml
- Feindura::$showErrors
- Feindura::$errorTag
- Feindura::$errorId
- Feindura::$errorClass
- Feindura::$errorAttributes
- Feindura::$titleLength
- Feindura::$titleAsLink
- Feindura::$titleShowPageDate
- Feindura::$titleShowCategory
- Feindura::$titleCategorySeparator
- Feindura::$thumbnailAlign
- Feindura::$thumbnailId
- Feindura::$thumbnailClass
- Feindura::$thumbnailAttributes
- Feindura::$thumbnailBefore
- Feindura::$thumbnailAfter
- FeinduraBase::createTitle() - to create the page title
- FeinduraBase::createThumbnail() - to check to show thumbnails are allowed and create the thumbnail <img> tag
- FeinduraBase::createAttributes() - to create the attributes used in the error tag
- FeinduraBase::shortenHtmlText() - to shorten the HTML page content
- FeinduraBase::shortenText() - to shorten the non HTML page content, if the $useHtml parameter is FALSE
- StatisticFunctions::formatDate() - to format the page date for output
- StatisticFunctions::dateDayBeforeAfter() - check if the page date is "yesterday" "today" or "tomorrow"
- GeneralFunctions::isPublicCategory() - to check whether the category is public
- GeneralFunctions::isPageContentArray() - to check if the given array is a $pageContent array
- GeneralFunctions::readPage() - to load the page if the $page parameter is an ID
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 875
| string createTitle ( |
array $pageContent, [int $titleLength = false], [bool $titleAsLink = false], [bool $titleShowPageDate = false], [bool $titleShowCategory = false], [ $titlePageDateSeparator = false], [string $titleCategorySeparator = false]) |
Parameters
| array | $pageContent |
the $pageContent Array of a page |
| int | $titleLength |
(optional) number of the maximal text length shown or FALSE to not shorten Default false |
| bool | $titleAsLink |
(optional) if TRUE, it creates the title as link Default false |
| bool | $titleShowPageDate |
(optional) if TRUE, it shows the page date before the title text Default false |
| bool | $titleShowCategory |
(optional) if TRUE, it shows the category name before the title text, and uses the $titleShowCategory parameter string between both Default false |
| string | $titleCategorySeparator |
(optional) string to seperate the category name and the title text, if the $titleShowCategory parameter is TRUE Default false |
| $titlePageDateSeparator |
Default false |
Description
Name createTitle()
Generates a page title from a given $pageContent array by using the given parameters.
Used By
- FeinduraBase::generatePage() - to create the page title
- Feindura::getPageTitle() - to generate the page title with the right title properties
Uses
- FeinduraBase::$categoryConfig - to check if showing the page date is allowed and for the category name
- FeinduraBase::$languageFile - for showing "yesterday", "today" or "tomorrow" instead of a page date
- FeinduraBase::shortenText() - to shorten the title text, if the $titleLength parameter is TRUE
- createHref() - to create the href if the $titleAsLink parameter is TRUE
- StatisticFunctions::formatDate() - to format the title date for output
- StatisticFunctions::dateDayBeforeAfter() - check if the title date is "yesterday" "today" or "tomorrow"
Return Value
Version
Parameters
| array | $pageContent |
the $pageContent array of a page |
Description
Name createThumbnail()
Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to display tag and the plain thumbnail path.
Used Constants
- DOCUMENTROOT the absolut path of the webserver
Used By
- FeinduraBase::generatePage() - to check to show thumbnails are allowed and create the thumbnail <img> tag
- Feindura::createLink() - to create the thumbnail for the link if the $linkShowThumbnail property is TRUE
Uses
- FeinduraBase::$adminConfig - for the thumbnail path
- FeinduraBase::$categoryConfig - to check if thumbnails are allowed for the th category of this page
- FeinduraBase::createAttributes() - to create the attributes used in the thumbnail <img> tag
Return Value
Version
line 1022
| string createAttributes ( |
string|number $id, string|number $class, string|number $attributes) |
Parameters
| string|number | $id |
a HTML id attribute value |
| string|number | $class |
a HTML class attribute value |
| string|number | $attributes |
one or more 'key="values"' attributes |
Description
Name createAttributes()
Generates a string with a given id, class and other attributes.
Check whether the given parameters are strings or numbers and add them to a string with attributes.
Example return: 'id="exampleId" class="exampleClass" key="value"'
Used By
- FeinduraBase::generatePage() - to create the attributes used in the error tag
- FeinduraBase::createThumbnail() - to create the attributes used in the thumbnail <img> tag
- Feindura::createLink() - to create the attributes used by the link <a> tag
- Feindura::createMenu() - to create the attributes used in the menu tag
- Feindura::listPages() - to create the attributes used in the menu tag
- Feindura::listPagesBySortFunction() - to create the attributes used in the menu tag
Return Value
Version
Parameters
| string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
| int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages |
Description
Name loadPagesByType()
Load pages by ID-type and ID(s).
If the $idType parameter start with "cat" it takes the given $ids parameter as category IDs.
If the $idType parameter start with "pag" it takes the given $ids parameter as page IDs.
While it is not important that whether the $idType parameter is written in plural or singular. The $ids parameter is automaticly checked whether its an array with IDs or a single ID.
Example of the returned $pageContent array: (Note This array will be wraped in another array, not shown here)
<?php array( "id" => 2, "category" => 1, "public" => true, "sortOrder" => 4, "lastSaveDate" => 1282348800, // UNIX-Timestamp "lastSaveAuthor" => 'fooMan', "title" => 'Example Page 2', "description" => '', "pageDate" => array( "before" => 'text before date', "date" => 1282348800, "after" => 'text after date' ), "tags" => 'winter summer', "plugins" => array( "plugin1" => array( "active" => true, "exampleConfigString" => 'example/path/', "exampleConfigNumber" => 500 ), "plugin2" => array( "active" => true, "exampleConfigBool1" => false, "exampleConfigBool2" => true, ) ), "thumbnail" => 'thumb_page2.jpg', "styleFile" => 'a:0:{}', // serialized array "styleId" => '', "styleClass" => '', "content" => '<p>Example Content</p>' ) ?>
Used By
- FeinduraBase::loadPagesByDate() - load the pages depending on the type
- FeinduraBase::hasTags() - to load pages by the given ID(s) for comparision
- Feindura::createMenu() - to load the page $pageContent array(s) from the given ID(s)
- Feindura::createMenuBySortFunction() - to load the pages which fit in the given time period parameters, sorted by the page date
- Feindura::listPages() - to load the page $pageContent array(s) from the given ID(s)
- Feindura::listPagesBySortFunction() - to load the page $pageContent array(s) from the given ID(s)
Uses
- isPageContentArray() - to check if the given array is a $pageContent array, if TRUE it just returns this array
- GeneralFunctions::isPublicCategory() - to check if the category(ies) or page(s) category(ies) are public
- GeneralFunctions::loadPages() - to load pages
- GeneralFunctions::readPage() - to load a single page
- GeneralFunctions::getPageCategory() - to get the category of the page
Return Value
Version
line 1194
| array|false loadPagesByDate ( |
string $idType, int|array|bool $ids, [int|bool|string $monthsInThePast = true], [int|bool|string $monthsInTheFuture = true], [bool $sortByCategories = false], [bool $reverseList = false]) |
Parameters
| string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
| int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages |
| int|bool|string | $monthsInThePast |
(optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| int|bool|string | $monthsInTheFuture |
(optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php Default true |
| bool | $sortByCategories |
(optional) determine whether the pages should only by sorted by page date or also seperated by categories and sorted by page date Default false |
| bool | $reverseList |
(optional) if TRUE the pages sorting will be reversed Default false |
Description
Name loadPagesByDate()
Loads pages by ID-type and ID, which fit in the given time period parameters.
Checks if the pages to load have a page date and the page date fit in the given $monthsInThePast and $monthsInTheFuture parameters. All time period parameters are compared against the date of TODAY.
The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.
Used By
- Feindura::createMenuByDate() - to load the pages which fit in the given time period parameters, sorted by the page date
- Feindura::listPagesByDate() - to load the pages which fit in the given time period parameters, sorted by the page date
Uses
- FeinduraBase::$categoryConfig - to check if in the category is sorting by page date allowed
- FeinduraBase::getPropertyIdsByType() - to get the property IDs if the $ids parameter is FALSE
- FeinduraBase::loadPagesByType() - load the pages depending on the type
- changeDate() - change the current date minus or plus the months from specified in the parameters
- gernalFunctions::sortPages() - to sort the pages by page date
Return Value
Version
Parameters
| array | $pageContent |
the $pageContent array of a page |
| array | $tags |
an array with tags to compare |
Description
Name compareTags()
Compares the given tags with the tags in the given $pageContent array.
If the given $pageContent array has one or more tags from the $tags parameter, it returns the $pageContent array otherwise it FALSE.
Notice: the tags will be compared case insensitive.
Used By
- FeinduraBase::hasTags() - to compare each tags between two strings
Return Value
Version
Parameters
| string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
| int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it checks all pages tags |
| string|array | $tags |
an string (seperated by "," or ";" or " ") or an array with tags to compare |
Description
Name hasTags()
Load pages by ID-type and ID(s), but only if the page(s) have one or more tags from the given $tags parameter.
Notice: the tags will be compared case insensitive.
Used By
- Feindura::createMenuByTags() - to get only the pages which have one or more tags from the given $tags parameter
- Feindura::listPagesByTags() - to get only the pages which have one or more tags from the given $tags parameter
Uses
- FeinduraBase::loadPagesByType() - to load pages by the given ID(s) for comparision
- FeinduraBase::compareTags() - to compare each tags between two strings
Return Value
Version
Parameters
| int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". (See example) (can also be a $pageContent array) |
Description
Name getPropertyIdsByString()
Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and the second as category ID.
If the given $ids parameter is a string/array with "previous" or "next" it returns the previous or next page ID from the current Feindura::$page property/Feindura::$category property on. If the given $ids parameter is a string/array with "first" or "last" it returns the first or last page ID in that category from the current Feindura::$page property/Feindura::$category property on. If the string is "random" it returns a random page ID in the current category, if its an array like: array('random','random') it would return a random page ID from a random category.
Notice: What is the first or last page/category depends on the sorting you have of the pages/categories in the feindura backend. Notice: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
Examples of possible $ids parameter.
<?php false // return the ids of the current $page property 2 // would return an array with the associated category of that page: array(2,1) 'next' // would return the next page, after the current $page property in the current category array('next',false) // the same as above array('next',45) // the same as above (it would discard the wrong category ID) array('next','next') // same as above (it would discard the wrong category ID) array(false,'next') // would return the first page of the next category, in the $categoryConfig property array('last','next') // would return the last page of the next category, in the $categoryConfig property array('last','first') // would return the last page of the first category, in the $categoryConfig property array('last','first') // would return the last page of the first category, in the $categoryConfig property array('rand','rand') // would return a random page of a random category, in the $categoryConfig property ?>
Example return value, where first value is the page ID and the second value is the category ID. array(2,1)
Used By
- Feindura::createHref() - to load the right page and category IDs depending on the $ids parameter
- Feindura::createLink() - to load the right page and category IDs depending on the $ids parameter
- Feindura::getPageTitle() - to load the right page and category IDs depending on the $ids parameter
- Feindura::showPage() - to load the right page and category IDs depending on the $ids parameter
- Feindura::hasPlugins() - to load the right page and category IDs depending on the $ids parameter
- Feindura::showPlugins() - to load the right page and category IDs depending on the $ids parameter
Uses
- FeinduraBase::getPropertyPage() - to get the right Feindura::$page property
- GeneralFunctions::getPageCategory() - to get the category ID of the given page
- GeneralFunctions::loadPages() - to load all pages in a category to find the right previous or next page and return it
Return Value
Version
Parameters
| string | $idType |
the ID type can be "page", "pages" or "category", "categories" |
| int|array|bool | $ids |
the category or page ID(s), if they are FALSE it returns the property ID, otherwise it passes the ID(s) through |
Description
Name getPropertyIdsByType()
If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category property.
Used By
- FeinduraBase::loadPagesByDate() - to get the property IDs if the $ids parameter is FALSE
- Feindura::createMenu() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- Feindura::createMenuByTags() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- Feindura::listPages() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- Feindura::listPagesByTags() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
- Feindura::listPagesBySortFunction() - if the $ids parameter is FALSE it gets the property category or page ID, depending on the $idType parameter
Uses
- FeinduraBase::getPropertyPage() - to get the right Feindura::$page property
- FeinduraBase::getPropertyCategory() - to get the right Feindura::$category property
Return Value
Version
Parameters
| int|bool | $page |
(optional) a page id or a boolean Default false |
Description
Name getPropertyPage()
Returns the Feindura::$page property if the given $page parameter is a Boolean.
Used By
- FeinduraBase::getPropertyIdsByString() - to get the right Feindura::$page property
- FeinduraBase::getPropertyIdsByType() - to get the right Feindura::$page property
Return Value
Version
Parameters
| int|bool | $category |
(optional) a category id or a boolean Default false |
Description
Name getPropertyCategory()
Returns the Feindura::$category property if the given $category parameter is a Boolean.
Used By
- FeinduraBase::getPropertyIdsByType() - to get the right Feindura::$category property
Return Value
Version
line 1769
| string shortenText ( |
string $string, int|array $length, [array|false $pageContent = false], [string|false $endString = " ..."]) |
Parameters
| string | $string |
the string to shorten |
| int|array | $length |
the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') |
| array|false | $pageContent |
(optional) the pageContent array of the page to create the "more" link to the page from Default false |
| string|false | $endString |
(optional) a string which will be put after the last character and before the "more" link Default " ..." |
Description
Name shortenText()
Shorten a text by to a given length.
If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.
Used By
- FeinduraBase::generatePage() - to shorten the non HTML page content, if the $useHtml parameter is FALSE
- FeinduraBase::createTitle() - to shorten the title text, if the $titleLength parameter is TRUE
- FeinduraBase::shortenHtmlText() - shorten the text
- Feindura::createLink() - to shorten the linktext if the $linkLength property is set
Uses
- createHref() - create the href for the "more" link
- GeneralFunctions::isPageContentArray() - check if the given $pageContent parameter is valid
Return Value
Version
line 1831
| string shortenHtmlText ( |
$input, int|array $length, [array|false $pageContent = false], [string|false $endString = ' ...'], string $string) |
Parameters
| string | $string |
the string to shorten |
| int|array | $length |
the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') |
| array|false | $pageContent |
(optional) the pageContent array of the page to create the "more" link to the page from Default false |
| string|false | $endString |
(optional) a string which will be put after the last character and before the "more" link Default ' ...' |
| $input |
|
Description
Name shortenHtmlText()
Shorten a HTML text by to a given length.
All HTML tags which are contained in the shortend text will be counted and closed on the end.
If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.
Used By
- FeinduraBase::generatePage() - to shorten the HTML page content
Uses
- FeinduraBase::shortenText() - shorten the text
- createHref() - create the href for the "more" link